/**
 * 
 */
package com.dream.house.dao.impl;

import java.util.HashMap;
import java.util.Map;

import cn.com.servyou.base.exception.DAOException;

import com.dream.house.dao.ReturnDAO;
import com.dream.house.dao.base.HouseBaseDAO;
import com.dream.house.entity.ReturnDTO;

/**
 * @author ahk
 * @since 1.0
 */
public class ReturnDAOImpl extends HouseBaseDAO implements ReturnDAO {

	/* (non-Javadoc)
	 * @see com.dream.house.dao.ReturnDAO#saveReturn(com.dream.house.entity.ReturnDTO)
	 */
	@Override
	public boolean saveReturn(ReturnDTO dto) throws DAOException {
		return createEntity("saveReturn", dto);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.ReturnDAO#updateReturn(com.dream.house.entity.ReturnDTO)
	 */
	@Override
	public boolean updateReturn(ReturnDTO dto) throws DAOException {
		return updateEntity("updateReturn", dto);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.ReturnDAO#removeReturn(java.lang.String)
	 */
	@Override
	public boolean removeReturn(String id) throws DAOException {
		return removeEntity("removeReturn", id);
	}

	/* (non-Javadoc)
	 * @see com.dream.house.dao.ReturnDAO#getReturn(java.lang.String)
	 */
	@Override
	public ReturnDTO getReturn(String id) throws DAOException {
		return (ReturnDTO)getEntity("getReturn",id);
	}

	/* (non-Javadoc)
	 * @see cn.com.servyou.base.dao.BaseDAO#getEntityName()
	 */
	@Override
	public String getEntityName() {
		return ReturnDTO.class.getCanonicalName();
	}

	@Override
	public ReturnDTO getReturnsByType(String type, String record_id)
			throws DAOException {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("type", type);
		map.put("record_id", record_id);
		
		return (ReturnDTO)getEntity("getReturnsByType", map);
	}

}
